import type { RouteRecordRaw } from 'vue-router';
import { UserRoleEnum } from '@/enums/UserRoleEnum';
import { RouteTypeEnum } from '@/enums/RouteTypeEnum';

export const routes: Array<RouteRecordRaw> = [
	{
		path: '/',
		children: [
			{
				path: '',
				name: 'home',
				component: () => import('@/views/HomeView.vue'),
				meta: {
					roleNeed: UserRoleEnum.USER,
					routeType: RouteTypeEnum.NAVIGATION,
				},
				children: [
					{
						path: '',
						name: 'table',
						component: () => import('@/components/AbbreviationInterfaceTable.vue'),
					},
				],
			},
			{
				path: 'console',
				name: 'console',
				component: () => import('@/views/ConsoleView.vue'),
				meta: {
					roleNeed: UserRoleEnum.ADMIN,
					routeType: RouteTypeEnum.NAVIGATION,
				},
			},
			{
				path: 'analysis',
				name: 'analysis',
				component: () => import('@/views/AnalysisView.vue'),
				meta: {
					roleNeed: UserRoleEnum.USER,
					routeType: RouteTypeEnum.NAVIGATION,
				},
			},
		],
	},
	{
		path: '/interface/:id',
		name: 'interface', // 接口详情
		component: () => import('@/views/InterfaceDocumentView.vue'),
	},
	{
		path: '/login',
		name: 'login',
		component: () => import('@/views/LoginView.vue'),
	},
	{
		path: '/no-authority',
		name: 'no-authority',
		component: () => import('@/views/NoAuthorityView.vue'),
	},
];
